package com.wondersgroup.framework.widget.taglib.charts;

import com.wondersgroup.framework.widget.annotations.WidgetTag;
import com.wondersgroup.framework.widget.annotations.WidgetTagAttribute;
import com.wondersgroup.framework.widget.util.OutputUtils;
import com.wondersgroup.framework.widget.validation.annotation.ValueValidate;
import javax.servlet.jsp.JspException;

@WidgetTag(name = "mscolumn", tldTagClass = "com.wondersgroup.framework.widget.taglib.charts.MultiColumnTag", description = "多系列柱状图表")
public class MultiColumnTag extends GraphModel {

    @ValueValidate( { "2d", "3d" })
    private String chartType = "2d";
    private String xAxisName = "";
    private String yAxisName = "";
    private String numberPrefix = "";
    private String numberSuffix = "";

    public String getNumberSuffix() {
        return this.numberSuffix;
    }

    @WidgetTagAttribute(description = "数字后缀")
    public void setNumberSuffix(String paramString) {
        this.numberSuffix = paramString;
    }

    public String getNumberPrefix() {
        return this.numberPrefix;
    }

    @WidgetTagAttribute(description = "数字前缀")
    public void setNumberPrefix(String paramString) {
        this.numberPrefix = paramString;
    }

    public String getChartType() {
        return this.chartType;
    }

    public String getXAxisName() {
        return this.xAxisName;
    }

    @WidgetTagAttribute(description = "x轴名称")
    public void setxAxisName(String paramString) {
        this.xAxisName = paramString;
    }

    public String getYAxisName() {
        return this.yAxisName;
    }

    @WidgetTagAttribute(description = "y轴名称")
    public void setyAxisName(String paramString) {
        this.yAxisName = paramString;
    }

    @WidgetTagAttribute(description = "柱状图表类型", required = true)
    public void setChartType(String paramString) {
        this.chartType = paramString;
    }

    protected String processEndGraphTagContent() throws JspException {
        StringBuffer localStringBuffer = new StringBuffer();
        localStringBuffer.append("xAxisName='" + getXAxisName()
                + "' yAxisName='" + getYAxisName() + "' ");
        String str = getNumberPrefix();
        if ((str != null) && (str.trim().length() != 0)) {
            localStringBuffer.append("numberPrefix='");
            localStringBuffer.append(str);
            localStringBuffer.append("' ");
        }
        str = getNumberSuffix();
        if ((str != null) && (str.trim().length() != 0)) {
            localStringBuffer.append("numberSuffix='");
            localStringBuffer.append(str);
            localStringBuffer.append("' ");
        }
        localStringBuffer.append(">");
        return localStringBuffer.toString();
    }

    protected String processStartTagContent() throws JspException {
        String str = "";
        if (getChartType().equals("2d"))
            str = OutputUtils.writeFlashFile(this.pageContext,
                    "fusioncharts/swfs/FCF_MSColumn2D.swf");
        if (getChartType().equals("3d"))
            str = OutputUtils.writeFlashFile(this.pageContext,
                    "fusioncharts/swfs/FCF_MSColumn3D.swf");
        return str;
    }
}